home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 1.4 KB | 54 lines | [TEXT/ttxt] |
- -- <<<-
-
- -- noticwin.sx
- -- by Doug "obsolete license plate" Kramer
-
- -- "Spaces and Presenters"
- -- ScriptX Components Guide
-
- module SpacesTest1 uses ScriptX end
- in module SpacesTest1
-
-
-
- class ClosableNoticeWindow (Window)
- end
-
- method init self {class ClosableNoticeWindow} #rest args ->
- apply nextMethod self type:@notice args -- calls init on superclasses
-
- method afterInit self {class ClosableNoticeWindow} #rest args -> (
- apply nextMethod self args -- calls init on superclasses
-
- -- create an actuator controller for any pushbuttons in the window
- new ActuatorController space:self wholespace:true
-
- -- create the pushbutton
- local closeButton := new Pushbutton
- closeButton.x := 75
- closeButton.y := 90
- closeButton.stroke := blackBrush
-
- -- define the released presenter
- local buttonText := new TextPresenter \
- boundary:(new Rect x2:50 y2:20) target:"Close"
- setDefaultAttr buttonText @alignment @center
- closeButton.releasedPresenter := buttonText
-
- -- define the pressed presenter
- closeButton.pressedPresenter := new TwoDShape \
- target:(new Rect x2:50 y2:20) fill:blackBrush
-
- -- define the window to hide when mouse button is released
- closeButton.activateAction := (undefined button ->
- hide button.presentedBy)
-
- -- append the button to the window and show the window
- append self closeButton
- show self
- )
-
- new ClosableNoticeWindow centered:true boundary:(new Rect x2:200 y2:200)
-
- -- >>>
-